package com.example.servlet;

import com.example.entity.User;
import com.example.service.MenuService;
import com.example.utils.BaseServlet;
import com.example.utils.InitResult;
import com.example.utils.ResultData;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@WebServlet("/menu")
public class MenuServlet extends BaseServlet {
    MenuService menuService=new MenuService();
    @Override
    public Class getChildClass() {
        return this.getClass();
    }
    public InitResult getMenusAll(HttpServletRequest request, HttpServletResponse response){
        HttpSession session = request.getSession();
        User user = (User)session.getAttribute("user");
        user.setId(1);
        return menuService.getMenusAll(user.getId());
    }
}
